 package handling.world.family;

 import client.MapleCharacter;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;

 public class MapleFamilyCharacter
   implements Serializable
 {
   public static final long serialVersionUID = 2058609046116597760L;
   private final int id;
   private final String name;
   private int level;
/*  15 */   private int channel = -1;
   private int jobid;
   private int familyid;
   private int seniorid;
   private int currentrep;
   private int totalrep;
   private int junior1;
   private int junior2;
   private boolean online;
/*  24 */   private List<Integer> pedigree = new ArrayList<>();
/*  25 */   private int descendants = 0;



   public MapleFamilyCharacter(MapleCharacter chr, int fid, int sid, int j1, int j2) {
/*  30 */     this.name = chr.getName();
/*  31 */     this.level = chr.getLevel();
/*  32 */     this.id = chr.getId();
/*  33 */     this.channel = chr.getClient().getChannel();
/*  34 */     this.jobid = chr.getJob();
/*  35 */     this.familyid = fid;
/*  36 */     this.junior1 = j1;
/*  37 */     this.junior2 = j2;
/*  38 */     this.seniorid = sid;
/*  39 */     this.currentrep = chr.getCurrentRep();
/*  40 */     this.totalrep = chr.getTotalRep();
/*  41 */     this.online = true;
   }


   public MapleFamilyCharacter(int _id, int _lv, String _name, int _channel, int _job, int _fid, int _sid, int _jr1, int _jr2, int _crep, int _trep, boolean _on) {
/*  46 */     this.level = _lv;
/*  47 */     this.id = _id;
/*  48 */     this.name = _name;
/*  49 */     if (_on) {
/*  50 */       this.channel = _channel;
     }
/*  52 */     this.jobid = _job;
/*  53 */     this.online = _on;
/*  54 */     this.familyid = _fid;
/*  55 */     this.seniorid = _sid;
/*  56 */     this.currentrep = _crep;
/*  57 */     this.totalrep = _trep;
/*  58 */     this.junior1 = _jr1;
/*  59 */     this.junior2 = _jr2;
   }

   public int getLevel() {
/*  63 */     return this.level;
   }

   public void setLevel(int l) {
/*  67 */     this.level = l;
   }

   public int getId() {
/*  71 */     return this.id;
   }

   public int getChannel() {
/*  75 */     return this.channel;
   }

   public void setChannel(int ch) {
/*  79 */     this.channel = ch;
   }

   public int getJobId() {
/*  83 */     return this.jobid;
   }

   public void setJobId(int job) {
/*  87 */     this.jobid = job;
   }

   public int getCurrentRep() {
/*  91 */     return this.currentrep;
   }

   public void setCurrentRep(int cr) {
/*  95 */     this.currentrep = cr;
   }

   public int getTotalRep() {
/*  99 */     return this.totalrep;
   }

   public void setTotalRep(int tr) {
/* 103 */     this.totalrep = tr;
   }

   public int getJunior1() {
/* 107 */     return this.junior1;
   }

   public void setJunior1(int trs) {
/* 111 */     this.junior1 = trs;
   }

   public int getJunior2() {
/* 115 */     return this.junior2;
   }

   public void setJunior2(int trs) {
/* 119 */     this.junior2 = trs;
   }

   public int getSeniorId() {
/* 123 */     return this.seniorid;
   }

   public void setSeniorId(int si) {
/* 127 */     this.seniorid = si;
   }

   public int getFamilyId() {
/* 131 */     return this.familyid;
   }

   public void setFamilyId(int fi) {
/* 135 */     this.familyid = fi;
   }

   public boolean isOnline() {
/* 139 */     return this.online;
   }

   public void setOnline(boolean f) {
/* 143 */     this.online = f;
   }

   public String getName() {
/* 147 */     return this.name;
   }


   public boolean equals(Object other) {
/* 152 */     if (!(other instanceof MapleFamilyCharacter)) {
/* 153 */       return false;
     }

/* 156 */     MapleFamilyCharacter o = (MapleFamilyCharacter)other;
/* 157 */     return (o.getId() == this.id && o.getName().equals(this.name));
   }

   public List<MapleFamilyCharacter> getAllJuniors(MapleFamily fam) {
/* 161 */     List<MapleFamilyCharacter> ret = new ArrayList<>();
/* 162 */     ret.add(this);
/* 163 */     if (this.junior1 > 0) {
/* 164 */       MapleFamilyCharacter chr = fam.getMFC(this.junior1);
/* 165 */       if (chr != null) {
/* 166 */         ret.addAll(chr.getAllJuniors(fam));
       }
     }


/* 171 */     if (this.junior2 > 0) {
/* 172 */       MapleFamilyCharacter chr = fam.getMFC(this.junior2);
/* 173 */       if (chr != null) {
/* 174 */         ret.addAll(chr.getAllJuniors(fam));
       }
     }


/* 179 */     return ret;
   }

   public List<MapleFamilyCharacter> getOnlineJuniors(MapleFamily fam) {
/* 183 */     List<MapleFamilyCharacter> ret = new ArrayList<>();
/* 184 */     ret.add(this);
/* 185 */     if (this.junior1 > 0) {
/* 186 */       MapleFamilyCharacter chr = fam.getMFC(this.junior1);
/* 187 */       if (chr != null) {
/* 188 */         if (chr.isOnline()) {
/* 189 */           ret.add(chr);
         }
/* 191 */         if (chr.getJunior1() > 0) {
/* 192 */           MapleFamilyCharacter chr2 = fam.getMFC(chr.getJunior1());
/* 193 */           if (chr2 != null && chr2.isOnline()) {
/* 194 */             ret.add(chr2);
           }
         }
/* 197 */         if (chr.getJunior2() > 0) {
/* 198 */           MapleFamilyCharacter chr2 = fam.getMFC(chr.getJunior2());
/* 199 */           if (chr2 != null && chr2.isOnline()) {
/* 200 */             ret.add(chr2);
           }
         }
       }
     }


/* 207 */     if (this.junior2 > 0) {
/* 208 */       MapleFamilyCharacter chr = fam.getMFC(this.junior2);
/* 209 */       if (chr != null) {
/* 210 */         if (chr.isOnline()) {
/* 211 */           ret.add(chr);
         }
/* 213 */         if (chr.getJunior1() > 0) {
/* 214 */           MapleFamilyCharacter chr2 = fam.getMFC(chr.getJunior1());
/* 215 */           if (chr2 != null && chr2.isOnline()) {
/* 216 */             ret.add(chr2);
           }
         }
/* 219 */         if (chr.getJunior2() > 0) {
/* 220 */           MapleFamilyCharacter chr2 = fam.getMFC(chr.getJunior2());
/* 221 */           if (chr2 != null && chr2.isOnline()) {
/* 222 */             ret.add(chr2);
           }
         }
       }
     }


/* 229 */     return ret;
   }

   public List<Integer> getPedigree() {
/* 233 */     return this.pedigree;
   }

   public void resetPedigree(MapleFamily fam) {
/* 237 */     this.pedigree = new ArrayList<>();
/* 238 */     this.pedigree.add(Integer.valueOf(this.id));
/* 239 */     if (this.seniorid > 0) {
/* 240 */       MapleFamilyCharacter chr = fam.getMFC(this.seniorid);
/* 241 */       if (chr != null) {
/* 242 */         this.pedigree.add(Integer.valueOf(this.seniorid));
/* 243 */         if (chr.getSeniorId() > 0) {
/* 244 */           this.pedigree.add(Integer.valueOf(chr.getSeniorId()));
         }
/* 246 */         if (chr.getJunior1() > 0 && chr.getJunior1() != this.id) {
/* 247 */           this.pedigree.add(Integer.valueOf(chr.getJunior1()));
/* 248 */         } else if (chr.getJunior2() > 0 && chr.getJunior2() != this.id) {
/* 249 */           this.pedigree.add(Integer.valueOf(chr.getJunior2()));
         }
       }
     }


/* 255 */     if (this.junior1 > 0) {
/* 256 */       MapleFamilyCharacter chr = fam.getMFC(this.junior1);
/* 257 */       if (chr != null) {
/* 258 */         this.pedigree.add(Integer.valueOf(this.junior1));
/* 259 */         if (chr.getJunior1() > 0) {
/* 260 */           this.pedigree.add(Integer.valueOf(chr.getJunior1()));
         }
/* 262 */         if (chr.getJunior2() > 0) {
/* 263 */           this.pedigree.add(Integer.valueOf(chr.getJunior2()));
         }
       }
     }


/* 269 */     if (this.junior2 > 0) {
/* 270 */       MapleFamilyCharacter chr = fam.getMFC(this.junior2);
/* 271 */       if (chr != null) {
/* 272 */         this.pedigree.add(Integer.valueOf(this.junior2));
/* 273 */         if (chr.getJunior1() > 0) {
/* 274 */           this.pedigree.add(Integer.valueOf(chr.getJunior1()));
         }
/* 276 */         if (chr.getJunior2() > 0) {
/* 277 */           this.pedigree.add(Integer.valueOf(chr.getJunior2()));
         }
       }
     }
   }




   public int getDescendants() {
/* 287 */     return this.descendants;
   }


   public int resetDescendants(MapleFamily fam) {
/* 292 */     this.descendants = 0;
/* 293 */     if (this.junior1 > 0) {
/* 294 */       MapleFamilyCharacter chr = fam.getMFC(this.junior1);
/* 295 */       if (chr != null) {
/* 296 */         this.descendants += 1 + chr.resetDescendants(fam);
       }
     }
/* 299 */     if (this.junior2 > 0) {
/* 300 */       MapleFamilyCharacter chr = fam.getMFC(this.junior2);
/* 301 */       if (chr != null) {
/* 302 */         this.descendants += 1 + chr.resetDescendants(fam);
       }
     }
/* 305 */     return this.descendants;
   }

   public int getNoJuniors() {
/* 309 */     int ret = 0;
/* 310 */     if (this.junior1 > 0) {
/* 311 */       ret++;
     }
/* 313 */     if (this.junior2 > 0) {
/* 314 */       ret++;
     }
/* 316 */     return ret;
   }


   public int hashCode() {
/* 321 */     return 31 + this.id;
   }
 }


/* Location:              C:\PGX\Server.jar!\handling\world\family\MapleFamilyCharacter.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */